package com.upcontrol.uartagent.entity;

import com.upcontrol.uartagent.utils.NetDataTypeTransform;

/**
 * Copyright (c) 2017, SuZhou CsjBot. All Rights Reserved.
 * www.csjbot.com
 * <p>
 * Created by 浦耀宗 at 2017/07/18 0018-08:58.
 * Email: puyz@csjbot.com
 */

public class RespMotorSpeedPacket extends UartPacket {
    //    左轮设定速度 右轮设定速度 左轮实时速度 右轮实时速度
    private int speed1 = -1, speed2 = -1, speed3 = -1, speed4 = -1;

    public String getMotorSpeed() {
        return "左轮设定速度 " + String.valueOf(speed1) +
                " ;右轮设定速度 " + String.valueOf(speed2) +
                " ;左轮实时速度 " + String.valueOf(speed3) +
                " ;右轮实时速度. " + String.valueOf(speed4);
    }

    public int[] getSpeedIntArray() {
        return new int[]{speed1, speed2, speed3, speed4,};
    }

    @Override
    public byte[] getContent() {
        return mContent;
    }

    @Override
    public void setContent(byte[] content) {
        speed1 = NetDataTypeTransform.bytesToInt(content, 0);
        speed2 = NetDataTypeTransform.bytesToInt(content, 4);
        speed3 = NetDataTypeTransform.bytesToInt(content, 8);
        speed4 = NetDataTypeTransform.bytesToInt(content, 12);
    }
}
